<template>
	<view style="padding:30rpx;">
		<!-- <view class="tabs-top">
			<view class="">医护登录</view>
			<view class="">患者登录</view>
		</view> -->
		<view class="">
			<input type="text" v-model="account" placeholder="账号" name="" id="" />
		</view>
		<view class="">
			<input type="password" v-model="password" placeholder="密码" name="" id="" />
		</view>
		<input class="login-button" @click="login" type="button" value="登录" />
	</view>
</template>

<script>
import { log } from 'util';
	export default {
		data() {
			return {
				account:"",
				password:""
			}
		},
		methods: {
			login(){
				uni.request({
					url:this.$apiUrl+'api/user/login',
					method:"POST",
					data:{account:this.account,password:this.password}
				}).then(res=>{
					if(res[1].data.code == 1){
						uni.setStorage({
							key: 'userInfo',
							data:JSON.stringify(res[1].data.data.userinfo),
							success: function () {
								console.log('success');
							}
						})
						
						uni.navigateTo({
							url:"/pages/index/index"
						})
					}else{
						uni.showToast({
							title:res[1].data.msg,
							icon:"none"
						})
					}
				})
			}
		}
	}
</script>

<style scoped>
.tabs-top{
	width: 100%;
	height: 40rpx;
}
input[type="text"],input[type="password"]{
	border: 1rpx solid #d5d5d5;
	height: 68rpx;
	margin-top:30rpx;
	font-size:26rpx;
	padding:0 12rpx;
}
.login-button{
	width: 100%;
	height: 68rpx;
	background: #24af5b;
	color: #fff;
	text-align: center;
	border-radius: 6rpx;margin-top:50rpx;
}
</style>
